package com.example.project.projectspringcloud.service.impl.workorder;

import com.example.project.projectspringcloud.dao.workorder.WorkOrderMapper;
import com.example.project.projectspringcloud.entity.Page;
import com.example.project.projectspringcloud.entity.workorder.WorkOrder;
import com.example.project.projectspringcloud.service.BaseService;
import com.example.project.projectspringcloud.service.workorder.WorkOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

@Service
@Transactional
public class WorkOrderServiceImpl extends BaseService<WorkOrder, WorkOrderMapper> implements WorkOrderService {

    @Autowired
    private WorkOrderMapper workOrderMapper;

    @Override
    public List<WorkOrder> list(WorkOrder workOrder, Page page) {
        return super.list(page, workOrder);
    }


    @Override
    public boolean save(WorkOrder workOrder) {
        workOrder.setCreateDate(new Date());
        return workOrderMapper.insertSelective(workOrder) > 0;
    }

    @Override
    public WorkOrder get(WorkOrder workOrder) {
        return super.mapper.selectOne(workOrder);
    }
}
